<?php
require_once('../../conf/config.php.inc');
require_once(SYBMAS_LIB_PATH.'/liblogin.php.inc');
require_once(SYBMAS_LAYOUT_PATH.'/layout.php.inc');
require_once(SYBMAS_LIB_PATH.'/libsybase.php.inc');
require_once(SYBMAS_LIB_PATH.'/libsybmas.php.inc');
require_once(SYBMAS_LAYOUT_PATH.'/menu.php.inc');
verificar_inicio_sesion();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link rel="stylesheet" type="text/css"
	href="<?php echo LAYOUT_URI?>/sybmasstyle.css">
<script src="<?php echo LAYOUT_URI?>/jquery-1.2.1.min.js"
	type="text/javascript"></script>
<script src="<?php echo LAYOUT_URI?>/menu-collapsed.js"
	type="text/javascript"></script>
<link rel="stylesheet" type="text/css"
	href="<?php echo LAYOUT_URI?>/style.css" >
<link rel="stylesheet" type="text/css"
	href="<?php echo JAVASCRIPT_URI?>/tabs/tabs.css">
<script src="<?php echo JAVASCRIPT_URI?>/tabs/tabs.js"
	type="text/javascript"></script>
<title>.:: Sybmas - Crear Bases de Datos</title>
<!--[if lt IE 8]>
   <style type="text/css">
   li a {display:inline-block;}
   li a {display:block;}
   </style>
   <![endif]-->
</head>
<body>
<script src="<?php echo JAVASCRIPT_URI?>/tooltip/wz_tooltip.js"
	type="text/javascript"></script>
<center>
<div id="container">
<div id="header"><?php generar_header();?></div>
<div id="scene">
<div id="modulos">
<ul id="menu" style="width: 150px;">
<?php generar_menu();?>
</ul>
</div>

<div id="title">Crear Bases de Datos</div>
<div id="main">

<form name ="formcreabd" method="POST" action="libcreabd.php">
<table>
	<tr>
		<td><span onmouseover="Tip('Nombre de la Base de Datos a Crear')" onmouseout="UnTip()">Nombre de la Base de Datos</span></td>
		   <td><input type="text" name="sybmas_bd" id="sybmas_bd"></td>              		                   
	</tr>
	<tr>
		<td><span onmouseover="Tip('Dispositivo en donde se creará la Base de Datos')" onmouseout="UnTip()">Dispositivo para Base de Datos</span></td>
		   <td><?php $sybmas_connection=start_sybmas_connection();		    
		    combodevice();
		    ?></td> 
		 <?php 		
		    function combodevice(){	
		  	 $query="SELECT name FROM master..sysdevices WHERE name not in('master','sysprocsdev','tapedump1','tapedump2')";		
			 echo "<select name='devicebd' id='devicebd'>";
			  $resultado=sybase_query($query);
			  while ($fila=sybase_fetch_row($resultado)){				
					echo"<option value='$fila[0]'>$fila[0]";			
				}				
			}
			echo "</select>";				
		?>
				 		       		
		<?php 
		//function espocupadevice(){
		  //$query="SELECT sum(c.size/512) as tamanio
			//	  FROM master..sysdatabases a, master..sysdevices b,master..sysusages c
              //    WHERE a.dbid=c.dbid and c.vstart between b.low and b.high
				//  AND b.name='master'";
		  //$sybuser_connection=start_default_sybuser_connection();
		  //$result=sybase_query($query,$sybuser_connection);
		  //while($data=sybase_fetch_array($result)){
		  	//echo $data['tamanio'];
		  //}
		//} 
		?>		                		                   
		<tr>
		<td><span onmouseover="Tip('Tamaño de la Base de Datos')" onmouseout="UnTip()">Tamaño de la Base de Datos</span></td>
		   <td><input type="text" name="sybmas_size" id="sybmas_size"></td>
		   <td>(Tamaño dado en MB)</td>              		                   
	    </tr>
		<tr>
		<td><span onmouseover="Tip('Dispositivo en donde se creara el Log de Transacciones')" onmouseout="UnTip()">Dispositivo para Log de Transacciones</span></td>
		   <td><?php //$sybmas_connection=start_sybmas_connection();		    
		    combodevicelog();
		    ?></td> 
		 <?php 		
		    function combodevicelog(){	
		  	 $query="SELECT name FROM master..sysdevices WHERE name not in('master','sysprocsdev','tapedump1','tapedump2')";		
			 echo "<select name='bdlog' id='bdlog'>";
			  $resultado=sybase_query($query);
			  while ($fila=sybase_fetch_row($resultado)){				
					echo"<option value='$fila[0]'>$fila[0]";
				}				
			}
			echo "</select>";				
		?>
		<tr>
		<td><span onmouseover="Tip('Tamaño del Log de Transacciones')" onmouseout="UnTip()">Tamaño para el Log de Transacciones</span></td>
		   <td><input type="text" name="sybmas_sizelog" id="sybmas_sizelog"></td>
		   <td>(Tamaño dado en MB)</td>              		                   
	    </tr>		             		                   
	</tr>
	       
	    <tr>	    
		<td colspan="2"><input type="submit" value="Crear Base de Datos">
		<input type="button" value="Cancelar" onclick="history.back()" >
	</tr>   
	<?php
	//}
	?>
</table>
</form>
</div>
<!-- main --></div>
<!-- scene --> <?php generar_footer();?></div>
</center>
</body>
</html>